package com.wang.example.netty.handler.client;

import com.wang.basic.netty.handler.Message;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;

/**
 * 该处理器给message加上时间戳
 */
public class EchoClientOutHandler2 extends ChannelOutboundHandlerAdapter{

    @Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        System.out.println("EchoClientOutHandler2 处理："+msg);
        Message message = (Message) msg;
        message.setTime(System.currentTimeMillis());
        ctx.write(msg, promise);
    }
}
